<layout name='Layout/layout_main' />

<style type="text/css">
	.icon input {
		margin-left: 10px;
		margin-top: 10px;
	}
</style>
<script type="text/javascript">
	function test() {
		form_search.submit();
	};

	function save(){
		sendForm("form_data", "{:U('set_duty')}");
	};

	function showdata(result){
		$("input[name='duty_list[]']").attr("checked",false);
		for (var s in result.data) {
			$("#duty_" + result.data[s].duty_id).attr("checked", "checked");
		}
	}

	$(document).ready(function() {
		set_return_url();

		$(".sub_left_menu  tr").click(function() {
			$(".sub_left_menu  tr").attr("class","");
			$(this).attr("class","active");
			$("#role_id").val($(this).attr("id"));
			sendAjax("{:U('get_duty_list')}", "role_id=" + $(this).attr("id"), function(data) {
				showdata(data);
			});
			return false;
		})
	});
</script>
<div class="admin" >
	<div class="row-fluid title">
		<span>业务管理映射</span>
	</div>
	<div class="row-fluid operate" >
		<div class="right">
			<a onclick="save()"  class="btn">保存</a>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span4 sub_left_menu">
			<table class="table table-bordered">
				<tr>
					<th>名称</th>
				</tr>
				<volist name="list" id="data">
					<tr id="{$data.id}">
						<td>{$data.name}</td>
					</tr>
				</volist>
			</table>
		</div>
		<div class="span8 sub_content">
			<form id="form_data" method="post" action="">
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="role_id" id="role_id">
				<table class="table table-bordered">
					<tr>
						<th class="checkbox">&nbsp;</th>
						<th>名称</th>
						<th>备注</th>
					</tr>
					<volist name="duty_list" id="data">
						<tr id="{$data.id}">
							<td>
								<input type="checkbox" id="duty_{$data.id}" name="duty_list[]" value="{$data.id}"></td>
							<td>{$data.name}</td>
							<td>{$data.remark}</td>
						</tr>
					</volist>
				</table>
			</form>
		</div>
	</div>
</div>